Welcome to JavaScript!

3.04 算术及字符串运算符练习

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Title</title>

<script type="text/javascript">

//如果存在纯数字字符窜,计算机自动转其为数字型进行运算

var a="6"-2; //返回值:4

//只要有一侧为非纯数字定符窜,结果为NaN(非数字类型)

var b="wyzxw5"-2; //返回值:NaN 非数字类型

document.write(typeof a,"<br>",a,"<br>")

document.write(typeof b,"<br>",b,"<br>")

</script>

</head>

<body>

</body>

</html>